package main

import "fmt"

func main() {
	a := [3]int{1, 2}           //未初始化的元素值为0
	b := [...]int{1, 2, 3}      //通过初始化值确定数组长度
	c := [5]int{2: 100, 4: 200} //通过索引号初始化元素,未初始化元素值为0

	fmt.Println(a, b, c)

	//支持多维数组
	d := [4][2]int{{10, 11}, {20, 21}, {30, 31}, {40, 41}}
	e := [...][2]int{{10, 11}, {20, 21}, {30, 31}, {40, 41}} //第二维不能写...
	f := [4][2]int{1: {10, 11}, 3: {30, 31}}
	g := [4][2]int{1: {0: 20}, 3: {1: 41}}
	fmt.Println(d, e, f, g)
}
